<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="text" id="input">
    <div id="content"></div>
<script>
    let arr=[1,2,3,4]
    let sum=arr.reduce((pre,cur)=>{
        return pre+cur
    })
    console.log(sum);


    // 实现双向绑定原理

   window.onload=()=>{
    const data={
            value:""
        }
        let input=document.getElementById("input")
        addEventListener("input",()=>{
            data.value=input.value//视图驱动数据
        })

        var p=new Proxy(data,(a,b,c)=>{

            if(b==="value"){
                const content=document.getElementById("content")
                content.innerHTML=c
            }

        })
   }
</script>    
</body>
</html>